package com.life.xxx.service.impl;

import com.life.xxx.entity.Shop;
import com.life.xxx.mapper.ShopMapper;
import com.life.xxx.service.ShopService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.life.xxx.util.Page;

import java.util.List;

/**
* <p>
    *  服务实现类
    * </p>
*
* @author csl
* @since 2025-08-07
*/
@Service
public class ShopServiceImpl extends ServiceImpl<ShopMapper, Shop> implements ShopService {

    @Autowired
    private ShopMapper shopMapper;

    @Override
    public Page<Shop> queryByPage(Page<Shop> page, Shop shop) {
        //1.查询当前的所有的记录数
        Integer totalCount = shopMapper.queryByCount( shop );
        page.setTotalCount( totalCount );
        //2.分页查询
        List<Shop> list =shopMapper.queryByPage(page.getFirst(),page.getPageSize(),shop);
        page.setResult( list );
        return page;
    }
}
